-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Move git clone management to a seperate API #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
internal/gitclone/manager.go
Outdated
| m.clones[upstreamURL] = repo | ||
| m.clonesMu.Unlock() | ||
|
|
||
| return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at this point we've discovered the git repo, so we can return fs.SkipDir to not recurse further.
| "-c", "http.postBuffer="+strconv.Itoa(config.GitConfig.PostBuffer), | ||
| "-c", "http.lowSpeedLimit="+strconv.Itoa(config.GitConfig.LowSpeedLimit), | ||
| "-c", "http.lowSpeedTime="+strconv.Itoa(int(config.GitConfig.LowSpeedTime.Seconds())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
internal/gitclone/manager.go
Outdated
|
|
||
| r.mu.Lock() | ||
| r.lastFetch = time.Now() | ||
| r.mu.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be keeping the lock while we're fetching?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes... it also made me realise that I think we probably have another locking issue where we probably need read locks as well for consumers 🤔
internal/strategy/git/bundle.go
Outdated
| return | ||
| } | ||
| // #nosec G204 - repo.Path() is controlled by us | ||
| cmd := exec.CommandContext(ctx, "git", "-C", repo.Path(), "bundle", "create", "-", "--branches", "--remotes") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should still be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was answered in #58 (comment)... correct me if there's a separate concern here.
…ck/sfptc into johnm/refactor-git-clone-api
…uring read operations
What?
Migrates the git clone component of the git strategy into a separate API
Why?
Experimentation on implementing private repo support for the gomod strategy in #56 revealed we are likely better off separating the git clone behaviour so that it can be shared between multiple strategies.